import Vue from 'vue'
import Router from 'vue-router'
import index from '@/pages/index'
import abouts from '@/pages/abouts'
import product from '@/pages/product'
import example from '@/pages/example'
import news from '@/pages/news'
import serve from '@/pages/serve'
import liveworld from '@/pages/liveworld'
import relation from '@/pages/relation'
import zxzx from '@/pages/zxzx'
import lxwm from '@/pages/lxwm'



Vue.use(Router)


const router = new Router({
  linkActiveClass:'active',
  routes: [

    {
      path: '/',
      name: 'Index',
      component: index
    },
    {
      path: '/Relation',
      name: 'Relation',
      component: relation
    },
    {
      path: '/Liveworld',
      name: 'Liveworld',
      component: liveworld
    },
    {
      path: '/Serve',
      name: 'Serve',
      component: serve
    },
    {
      path: '/News',
      name: 'News',
      component: news
    },
    {
      path: '/Example',
      name: 'Example',
      component: example
    },
    {
      path: '/Product',
      name: 'Product',
      component: product
    },{
      path: '/Abouts',
      name: 'Abouts',
      component: abouts
    },{
      path: '/zxzx',
      name: 'Zxzx',
      component: zxzx
    },{
      path: '/lxwm',
      name: 'Lxwm',
      component: lxwm
    }

  ]
})

router.beforeEach((to, from, next) => {
  let flag = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)
  if(flag){
    console.log('手机端');
    window.location.href="http://39.100.198.26:8080/mb/cabinet/mobile/#/"
  }else{
    console.log('pc端');
    next();
  }
})

export default  router
